{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pymongo\n",
    "import pandas as pd\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['VnTrader_Log_Db', 'admin', 'config', 'local', 'test']\n"
     ]
    }
   ],
   "source": [
    "mongo_client = pymongo.MongoClient('mongodb://localhost:27017/')\n",
    "dblist = mongo_client.list_database_names()\n",
    "print(dblist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>display_name</th>\n",
       "      <th>name</th>\n",
       "      <th>start_date</th>\n",
       "      <th>end_date</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>000001.XSHE</td>\n",
       "      <td>平安银行</td>\n",
       "      <td>PAYH</td>\n",
       "      <td>1991/4/3</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>000002.XSHE</td>\n",
       "      <td>万科A</td>\n",
       "      <td>WKA</td>\n",
       "      <td>1991/1/29</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>000004.XSHE</td>\n",
       "      <td>国农科技</td>\n",
       "      <td>GNKJ</td>\n",
       "      <td>1990/12/1</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>000005.XSHE</td>\n",
       "      <td>世纪星源</td>\n",
       "      <td>SJXY</td>\n",
       "      <td>1990/12/10</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>000006.XSHE</td>\n",
       "      <td>深振业A</td>\n",
       "      <td>SZYA</td>\n",
       "      <td>1992/4/27</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>000007.XSHE</td>\n",
       "      <td>全新好</td>\n",
       "      <td>QXH</td>\n",
       "      <td>1992/4/13</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>000008.XSHE</td>\n",
       "      <td>神州高铁</td>\n",
       "      <td>SZGT</td>\n",
       "      <td>1992/5/7</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>000009.XSHE</td>\n",
       "      <td>中国宝安</td>\n",
       "      <td>ZGBA</td>\n",
       "      <td>1991/6/25</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>000010.XSHE</td>\n",
       "      <td>美丽生态</td>\n",
       "      <td>SHX</td>\n",
       "      <td>1995/10/27</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>000011.XSHE</td>\n",
       "      <td>深物业A</td>\n",
       "      <td>SWYA</td>\n",
       "      <td>1992/3/30</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>000012.XSHE</td>\n",
       "      <td>南玻A</td>\n",
       "      <td>NBA</td>\n",
       "      <td>1992/2/28</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>000014.XSHE</td>\n",
       "      <td>沙河股份</td>\n",
       "      <td>SHGF</td>\n",
       "      <td>1992/6/2</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>000016.XSHE</td>\n",
       "      <td>深康佳A</td>\n",
       "      <td>SKJA</td>\n",
       "      <td>1992/3/27</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>000017.XSHE</td>\n",
       "      <td>深中华A</td>\n",
       "      <td>SZHA</td>\n",
       "      <td>1992/3/31</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>000018.XSHE</td>\n",
       "      <td>神州长城</td>\n",
       "      <td>SZCC</td>\n",
       "      <td>1992/6/16</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>000019.XSHE</td>\n",
       "      <td>深深宝A</td>\n",
       "      <td>SSBA</td>\n",
       "      <td>1992/10/12</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>000020.XSHE</td>\n",
       "      <td>深华发A</td>\n",
       "      <td>SHFA</td>\n",
       "      <td>1992/4/28</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>000021.XSHE</td>\n",
       "      <td>深科技</td>\n",
       "      <td>SKJ</td>\n",
       "      <td>1994/2/2</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>000022.XSHE</td>\n",
       "      <td>深赤湾A</td>\n",
       "      <td>SCWA</td>\n",
       "      <td>1993/5/5</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>000023.XSHE</td>\n",
       "      <td>深天地A</td>\n",
       "      <td>STDA</td>\n",
       "      <td>1993/4/29</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>000024.XSHE</td>\n",
       "      <td>招商地产</td>\n",
       "      <td>ZSDC</td>\n",
       "      <td>1993/6/7</td>\n",
       "      <td>2015/12/30</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>000025.XSHE</td>\n",
       "      <td>特力A</td>\n",
       "      <td>TLA</td>\n",
       "      <td>1993/6/21</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>000026.XSHE</td>\n",
       "      <td>飞亚达A</td>\n",
       "      <td>FYDA</td>\n",
       "      <td>1993/6/3</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>000027.XSHE</td>\n",
       "      <td>深圳能源</td>\n",
       "      <td>SZNY</td>\n",
       "      <td>1993/9/3</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>000028.XSHE</td>\n",
       "      <td>国药一致</td>\n",
       "      <td>GYYZ</td>\n",
       "      <td>1993/8/9</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>000029.XSHE</td>\n",
       "      <td>深深房A</td>\n",
       "      <td>SSFA</td>\n",
       "      <td>1993/9/15</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>000030.XSHE</td>\n",
       "      <td>富奥股份</td>\n",
       "      <td>FAGF</td>\n",
       "      <td>1993/9/29</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>000031.XSHE</td>\n",
       "      <td>中粮地产</td>\n",
       "      <td>ZLDC</td>\n",
       "      <td>1993/10/8</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>000032.XSHE</td>\n",
       "      <td>深桑达A</td>\n",
       "      <td>SSDA</td>\n",
       "      <td>1993/10/28</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>000033.XSHE</td>\n",
       "      <td>新都退</td>\n",
       "      <td>STXD</td>\n",
       "      <td>1994/1/3</td>\n",
       "      <td>2017/7/6</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3609</th>\n",
       "      <td>603936.XSHG</td>\n",
       "      <td>博敏电子</td>\n",
       "      <td>BMDZ</td>\n",
       "      <td>2015/12/9</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3610</th>\n",
       "      <td>603937.XSHG</td>\n",
       "      <td>丽岛新材</td>\n",
       "      <td>LDXC</td>\n",
       "      <td>2017/11/2</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3611</th>\n",
       "      <td>603938.XSHG</td>\n",
       "      <td>三孚股份</td>\n",
       "      <td>SFGF</td>\n",
       "      <td>2017/6/28</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3612</th>\n",
       "      <td>603939.XSHG</td>\n",
       "      <td>益丰药房</td>\n",
       "      <td>YFYF</td>\n",
       "      <td>2015/2/17</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3613</th>\n",
       "      <td>603955.XSHG</td>\n",
       "      <td>大千生态</td>\n",
       "      <td>DQST</td>\n",
       "      <td>2017/3/10</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3614</th>\n",
       "      <td>603958.XSHG</td>\n",
       "      <td>哈森股份</td>\n",
       "      <td>HSGF</td>\n",
       "      <td>2016/6/29</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3615</th>\n",
       "      <td>603959.XSHG</td>\n",
       "      <td>百利科技</td>\n",
       "      <td>BLKJ</td>\n",
       "      <td>2016/5/17</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3616</th>\n",
       "      <td>603960.XSHG</td>\n",
       "      <td>克来机电</td>\n",
       "      <td>KLJD</td>\n",
       "      <td>2017/3/14</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3617</th>\n",
       "      <td>603963.XSHG</td>\n",
       "      <td>大理药业</td>\n",
       "      <td>DLYY</td>\n",
       "      <td>2017/9/22</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3618</th>\n",
       "      <td>603966.XSHG</td>\n",
       "      <td>法兰泰克</td>\n",
       "      <td>FLTK</td>\n",
       "      <td>2017/1/25</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3619</th>\n",
       "      <td>603968.XSHG</td>\n",
       "      <td>醋化股份</td>\n",
       "      <td>CHGF</td>\n",
       "      <td>2015/5/18</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3620</th>\n",
       "      <td>603969.XSHG</td>\n",
       "      <td>银龙股份</td>\n",
       "      <td>YLGF</td>\n",
       "      <td>2015/2/27</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3621</th>\n",
       "      <td>603970.XSHG</td>\n",
       "      <td>中农立华</td>\n",
       "      <td>ZNLH</td>\n",
       "      <td>2017/11/16</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3622</th>\n",
       "      <td>603976.XSHG</td>\n",
       "      <td>正川股份</td>\n",
       "      <td>ZCGF</td>\n",
       "      <td>2017/8/22</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3623</th>\n",
       "      <td>603977.XSHG</td>\n",
       "      <td>国泰集团</td>\n",
       "      <td>GTJT</td>\n",
       "      <td>2016/11/11</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3624</th>\n",
       "      <td>603978.XSHG</td>\n",
       "      <td>深圳新星</td>\n",
       "      <td>SZXX</td>\n",
       "      <td>2017/8/7</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3625</th>\n",
       "      <td>603979.XSHG</td>\n",
       "      <td>金诚信</td>\n",
       "      <td>JCX</td>\n",
       "      <td>2015/6/30</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3626</th>\n",
       "      <td>603980.XSHG</td>\n",
       "      <td>吉华集团</td>\n",
       "      <td>JHJT</td>\n",
       "      <td>2017/6/15</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3627</th>\n",
       "      <td>603985.XSHG</td>\n",
       "      <td>恒润股份</td>\n",
       "      <td>HRGF</td>\n",
       "      <td>2017/5/5</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3628</th>\n",
       "      <td>603986.XSHG</td>\n",
       "      <td>兆易创新</td>\n",
       "      <td>ZYCX</td>\n",
       "      <td>2016/8/18</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3629</th>\n",
       "      <td>603987.XSHG</td>\n",
       "      <td>康德莱</td>\n",
       "      <td>KDL</td>\n",
       "      <td>2016/11/21</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3630</th>\n",
       "      <td>603988.XSHG</td>\n",
       "      <td>中电电机</td>\n",
       "      <td>ZDDJ</td>\n",
       "      <td>2014/11/4</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3631</th>\n",
       "      <td>603989.XSHG</td>\n",
       "      <td>艾华集团</td>\n",
       "      <td>AHJT</td>\n",
       "      <td>2015/5/15</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3632</th>\n",
       "      <td>603990.XSHG</td>\n",
       "      <td>麦迪科技</td>\n",
       "      <td>MDKJ</td>\n",
       "      <td>2016/12/8</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3633</th>\n",
       "      <td>603991.XSHG</td>\n",
       "      <td>至正股份</td>\n",
       "      <td>ZZGF</td>\n",
       "      <td>2017/3/8</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3634</th>\n",
       "      <td>603993.XSHG</td>\n",
       "      <td>洛阳钼业</td>\n",
       "      <td>LYMY</td>\n",
       "      <td>2012/10/9</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3635</th>\n",
       "      <td>603996.XSHG</td>\n",
       "      <td>中新科技</td>\n",
       "      <td>ZXKJ</td>\n",
       "      <td>2015/12/22</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3636</th>\n",
       "      <td>603997.XSHG</td>\n",
       "      <td>继峰股份</td>\n",
       "      <td>JFGF</td>\n",
       "      <td>2015/3/2</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3637</th>\n",
       "      <td>603998.XSHG</td>\n",
       "      <td>方盛制药</td>\n",
       "      <td>FSZY</td>\n",
       "      <td>2014/12/5</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3638</th>\n",
       "      <td>603999.XSHG</td>\n",
       "      <td>读者传媒</td>\n",
       "      <td>DZCM</td>\n",
       "      <td>2015/12/10</td>\n",
       "      <td>2200/1/1</td>\n",
       "      <td>stock</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3639 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             code display_name  name  start_date    end_date   type\n",
       "0     000001.XSHE         平安银行  PAYH    1991/4/3    2200/1/1  stock\n",
       "1     000002.XSHE          万科A   WKA   1991/1/29    2200/1/1  stock\n",
       "2     000004.XSHE         国农科技  GNKJ   1990/12/1    2200/1/1  stock\n",
       "3     000005.XSHE         世纪星源  SJXY  1990/12/10    2200/1/1  stock\n",
       "4     000006.XSHE         深振业A  SZYA   1992/4/27    2200/1/1  stock\n",
       "5     000007.XSHE          全新好   QXH   1992/4/13    2200/1/1  stock\n",
       "6     000008.XSHE         神州高铁  SZGT    1992/5/7    2200/1/1  stock\n",
       "7     000009.XSHE         中国宝安  ZGBA   1991/6/25    2200/1/1  stock\n",
       "8     000010.XSHE         美丽生态   SHX  1995/10/27    2200/1/1  stock\n",
       "9     000011.XSHE         深物业A  SWYA   1992/3/30    2200/1/1  stock\n",
       "10    000012.XSHE          南玻A   NBA   1992/2/28    2200/1/1  stock\n",
       "11    000014.XSHE         沙河股份  SHGF    1992/6/2    2200/1/1  stock\n",
       "12    000016.XSHE         深康佳A  SKJA   1992/3/27    2200/1/1  stock\n",
       "13    000017.XSHE         深中华A  SZHA   1992/3/31    2200/1/1  stock\n",
       "14    000018.XSHE         神州长城  SZCC   1992/6/16    2200/1/1  stock\n",
       "15    000019.XSHE         深深宝A  SSBA  1992/10/12    2200/1/1  stock\n",
       "16    000020.XSHE         深华发A  SHFA   1992/4/28    2200/1/1  stock\n",
       "17    000021.XSHE          深科技   SKJ    1994/2/2    2200/1/1  stock\n",
       "18    000022.XSHE         深赤湾A  SCWA    1993/5/5    2200/1/1  stock\n",
       "19    000023.XSHE         深天地A  STDA   1993/4/29    2200/1/1  stock\n",
       "20    000024.XSHE         招商地产  ZSDC    1993/6/7  2015/12/30  stock\n",
       "21    000025.XSHE          特力A   TLA   1993/6/21    2200/1/1  stock\n",
       "22    000026.XSHE         飞亚达A  FYDA    1993/6/3    2200/1/1  stock\n",
       "23    000027.XSHE         深圳能源  SZNY    1993/9/3    2200/1/1  stock\n",
       "24    000028.XSHE         国药一致  GYYZ    1993/8/9    2200/1/1  stock\n",
       "25    000029.XSHE         深深房A  SSFA   1993/9/15    2200/1/1  stock\n",
       "26    000030.XSHE         富奥股份  FAGF   1993/9/29    2200/1/1  stock\n",
       "27    000031.XSHE         中粮地产  ZLDC   1993/10/8    2200/1/1  stock\n",
       "28    000032.XSHE         深桑达A  SSDA  1993/10/28    2200/1/1  stock\n",
       "29    000033.XSHE          新都退  STXD    1994/1/3    2017/7/6  stock\n",
       "...           ...          ...   ...         ...         ...    ...\n",
       "3609  603936.XSHG         博敏电子  BMDZ   2015/12/9    2200/1/1  stock\n",
       "3610  603937.XSHG         丽岛新材  LDXC   2017/11/2    2200/1/1  stock\n",
       "3611  603938.XSHG         三孚股份  SFGF   2017/6/28    2200/1/1  stock\n",
       "3612  603939.XSHG         益丰药房  YFYF   2015/2/17    2200/1/1  stock\n",
       "3613  603955.XSHG         大千生态  DQST   2017/3/10    2200/1/1  stock\n",
       "3614  603958.XSHG         哈森股份  HSGF   2016/6/29    2200/1/1  stock\n",
       "3615  603959.XSHG         百利科技  BLKJ   2016/5/17    2200/1/1  stock\n",
       "3616  603960.XSHG         克来机电  KLJD   2017/3/14    2200/1/1  stock\n",
       "3617  603963.XSHG         大理药业  DLYY   2017/9/22    2200/1/1  stock\n",
       "3618  603966.XSHG         法兰泰克  FLTK   2017/1/25    2200/1/1  stock\n",
       "3619  603968.XSHG         醋化股份  CHGF   2015/5/18    2200/1/1  stock\n",
       "3620  603969.XSHG         银龙股份  YLGF   2015/2/27    2200/1/1  stock\n",
       "3621  603970.XSHG         中农立华  ZNLH  2017/11/16    2200/1/1  stock\n",
       "3622  603976.XSHG         正川股份  ZCGF   2017/8/22    2200/1/1  stock\n",
       "3623  603977.XSHG         国泰集团  GTJT  2016/11/11    2200/1/1  stock\n",
       "3624  603978.XSHG         深圳新星  SZXX    2017/8/7    2200/1/1  stock\n",
       "3625  603979.XSHG          金诚信   JCX   2015/6/30    2200/1/1  stock\n",
       "3626  603980.XSHG         吉华集团  JHJT   2017/6/15    2200/1/1  stock\n",
       "3627  603985.XSHG         恒润股份  HRGF    2017/5/5    2200/1/1  stock\n",
       "3628  603986.XSHG         兆易创新  ZYCX   2016/8/18    2200/1/1  stock\n",
       "3629  603987.XSHG          康德莱   KDL  2016/11/21    2200/1/1  stock\n",
       "3630  603988.XSHG         中电电机  ZDDJ   2014/11/4    2200/1/1  stock\n",
       "3631  603989.XSHG         艾华集团  AHJT   2015/5/15    2200/1/1  stock\n",
       "3632  603990.XSHG         麦迪科技  MDKJ   2016/12/8    2200/1/1  stock\n",
       "3633  603991.XSHG         至正股份  ZZGF    2017/3/8    2200/1/1  stock\n",
       "3634  603993.XSHG         洛阳钼业  LYMY   2012/10/9    2200/1/1  stock\n",
       "3635  603996.XSHG         中新科技  ZXKJ  2015/12/22    2200/1/1  stock\n",
       "3636  603997.XSHG         继峰股份  JFGF    2015/3/2    2200/1/1  stock\n",
       "3637  603998.XSHG         方盛制药  FSZY   2014/12/5    2200/1/1  stock\n",
       "3638  603999.XSHG         读者传媒  DZCM  2015/12/10    2200/1/1  stock\n",
       "\n",
       "[3639 rows x 6 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"C:\\\\quanttime\\\\data\\\\basic_info\\\\all_stock_info.csv\", encoding=\"gbk\")\n",
    "#data = data.head(5)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'code': '000001.XSHE',\n",
       "  'display_name': '平安银行',\n",
       "  'name': 'PAYH',\n",
       "  'start_date': '1991/4/3',\n",
       "  'end_date': '2200/1/1',\n",
       "  'type': 'stock'},\n",
       " {'code': '000002.XSHE',\n",
       "  'display_name': '万科A',\n",
       "  'name': 'WKA',\n",
       "  'start_date': '1991/1/29',\n",
       "  'end_date': '2200/1/1',\n",
       "  'type': 'stock'},\n",
       " {'code': '000004.XSHE',\n",
       "  'display_name': '国农科技',\n",
       "  'name': 'GNKJ',\n",
       "  'start_date': '1990/12/1',\n",
       "  'end_date': '2200/1/1',\n",
       "  'type': 'stock'},\n",
       " {'code': '000005.XSHE',\n",
       "  'display_name': '世纪星源',\n",
       "  'name': 'SJXY',\n",
       "  'start_date': '1990/12/10',\n",
       "  'end_date': '2200/1/1',\n",
       "  'type': 'stock'},\n",
       " {'code': '000006.XSHE',\n",
       "  'display_name': '深振业A',\n",
       "  'name': 'SZYA',\n",
       "  'start_date': '1992/4/27',\n",
       "  'end_date': '2200/1/1',\n",
       "  'type': 'stock'}]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data.head(5)\n",
    "dict1 = data.to_dict(orient =\"record\")\n",
    "dict1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'000000'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "list_file = os.listdir(\"C:\\\\quanttime\\\\data\\\\finance\\\\valuation\\\\\")\n",
    "list_file[0].split(\".\")[0]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
